<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>yanjing</title>
    <link rel="stylesheet" href="yanjing.css">
    <script src="js/angular.min.js" type="text/javascript"></script>
    <script src="js/angular-ui-router.js" type="text/javascript"></script>
    <script src="js/jquery-3.1.1.js" type="text/javascript"></script>
    <script src="js/baiduTemplate.js"></script>
</head>
<body>
<div class="yanjing"></div>
<div class="yanImg">

</div>
</body>
<script type="text/html" id="tmp">
    <%for(var i = 0 ; i < arr.length ; i++){%>
    <div class="imgDiv">
        <img class="divImg" src="<%=arr[i].imageUrl%>" alt=""><br>
        <span><%=arr[i].title%></span><br>
        <span style="color: red">￥<%=arr[i].price%></span>
    </div>
    <%}%>
</script>
<script>
    var obj={};
    function getAllMsg() {
        $.get("http://localhost:6500/getAll",{},function (res) {
            console.log(res)
            $(".yanjing").html(res[0].categoryName);
            obj.arr=res[0].item;
            $(".yanImg").html(baidu.template("tmp",obj));
            })
        }
        getAllMsg()
</script>
</html>